class Promise{
    callbacks=[]
  constructor(executor){
      executor(this.resolve.bind(this))
  }
  then(fn){
    this.callbacks.push(fn)
  }
  resolve(value){
   this.callbacks.forEach((element) => {
     element(value);
   });
  }
}
new Promise((reasolve)=>{
  console.log('promise');
  setTimeout(()=>{
    reasolve(1);
  },1000)
}).then(res=>{
  console.log(res)
})
console.log('先打印');
